package com.example.app.model;

import com.example.app.model.common.CommonModel;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * Created by wangtao on 2018/7/2.
 * 小程序购买商品记录
 */
@Entity(name = "app_product_record")
@Data
public class AppProductRecord extends CommonModel {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    // 会员编号
    @NotNull(message = "memberId不能为空")
    @Column(name = "member_id")
    private Long memberId;
    // 购买商品
    @NotNull(message = "productName不能为空")
    @Column(name = "product_name")
    private String productName;
    // 购买数量
    @NotNull(message = "productCount不能为空")
    @Column(name = "product_count")
    private int productCount;
    // 购买单价
    @NotNull(message = "unitPrice不能为空")
    @Column(name = "unit_price")
    private BigDecimal unitPrice;
    // 购买总价格
    @NotNull(message = "totalPrice不能为空")
    @Column(name = "total_price")
    private BigDecimal totalPrice;
    // 账户编号
    @Column(name = "account_id")
    private Long accountId;
    // 用户编号
    @Column(name = "user_id")
    private Long userId;
    // 组织机构编号
    @Column(name = "organ_id")
    private Long organId;
    // 组织机构名称
    @Column(name = "organ_name")
    private String organName;
}
